$(document).ready(function(){
    $("#sort_ul").sortable({});
});
  
function print_ul(url)
{
    var authenticity_token = $('#hidden_form input').val();
    url += "?authenticity_token=" + authenticity_token;
    var strJson = "[";
    var length =  $('.sortableitem').length;
    $('.sortableitem').each(function(i) {
        strJson +="{\"id\":\"" +  $(this).attr("id") + "\",\"order\":\"" + (length -i) + "\"}";
        if (i !=length-1)
        {
            strJson +=","
            }
    });
    strJson += "]";
    jQuery.post(url,
    {
        json:strJson
    },
    function(msg){
        msgbox(msg);
    });


}
